package com.zhongwang.mms.module.buy.service;

import com.zhongwang.mms.module.buy.dao.BuyPlanDao;
import com.zhongwang.mms.module.buy.model.ShoppingPlanModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 采购管理 -> 采购计划综合查询 Service
 *
 * @Author: China.sgl
 * @Date: 2020/4/7 16:25
 */
@SuppressWarnings("ALL")
@Service
public class IntegrateQueryService {

    @Autowired
    private BuyPlanDao buyPlanDao;

    /**
     * 根据条件查询综合信息
     *
     * @param shoppingPlanModel 条件
     * @return List
     */
    public List<ShoppingPlanModel> findIntegrate(ShoppingPlanModel shoppingPlanModel) {
        List<ShoppingPlanModel> list = null;
        try {
            if (shoppingPlanModel.getProProductionStatusListText() != null) {
                if (shoppingPlanModel.getProProductionStatusListText().contains("-1")) {
                    shoppingPlanModel.setProProductionStatusListText(null);
                }
            }
            if (shoppingPlanModel.getSppStatusListText() != null) {
                if (shoppingPlanModel.getSppStatusListText().contains("-1")) {
                    shoppingPlanModel.setSppStatusListText(null);
                }
            }
            list = buyPlanDao.findIntegrate(shoppingPlanModel);
        }catch (Exception e){
            e.printStackTrace();
        }
        return list;
    }
}
